<template>
  <div class="adminHandle" >
    <div class="showBox">
    <el-table
      :data="tableDataExam"
      style="width: 100%">
      <el-table-column
        prop="courseName"
        label="课程名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="clazzRoom"
        label="考场"
        width="200">
      </el-table-column>
      <el-table-column
        prop="teacherName"
        label="监考老师"
        width="200">
      </el-table-column>
      <el-table-column
        prop="startTime"
        label="开始时间">
      </el-table-column>
      <el-table-column
        prop="endTime"
        label="结束时间">
      </el-table-column>
    </el-table>
    </div>
  </div>
</template>

<script>
  import axios from 'axios'

export default {
  name: "StudentExamInit",
  data(){
    return{
      tableDataExam: []
    }
  },
  mounted() {
    this.ip = localStorage.getItem('ip');
    this.token = sessionStorage.getItem('token');

    axios.defaults.headers.common["token"] = this.token;
    axios.get((this.ip + '/exam/student')).then((response)=>{
      console.log(response)
      console.log(response.data)
      for(let i=0;i<response.data.length;i++){
        this.tableDataExam.push({
          courseName:response.data[i].courseName,
          clazzRoom:response.data[i].clazzRoom,
          teacherName:response.data[i].teacherName,
          startTime:response.data[i].startTime,
          endTime:response.data[i].endTime
        })
      }
    }).catch(function (error) {
      console.log(error);
    });


  }
}
</script>

<style scoped>
.adminHandle{
  width: 100%;
  padding: 5px 10px 0 10px;
  margin: 20px 100px 0 100px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
}
.showBox{
  margin: 30px 30px 0;
}
</style>
